using System;
using System.Collections.Generic;
using System.Linq;

namespace Windy.OpenLink.ObjectPools
{
    public interface IObjectPool
    {
        object this[string id] { get; set; }

        bool TryGet(string id, out object value);

        int Count { get; }

        T Get<T>(string id)
            where T : class;

        void Set<T>(string id, T value)
            where T : class;

        IEnumerable<string> Ids { get; }

        bool IsExist(string id);

        bool Remove(string id);

        bool RemoveTree(string id, bool includeRoot = true);

        IEnumerable<KeyValuePair<string, object>> AsEnumerable();
    }
}
